#!/bin/bash
PACKAGE_NAME="kaldifst"
TARGET_VERSION="1.7.14"

INSTALLED_VERSION=$(conda_run_cmd python -c "import $PACKAGE_NAME; print($PACKAGE_NAME.__version__)" 2>/dev/null)

if [ $? -eq 0 ]; then
    echo "$PACKAGE_NAME ver: $INSTALLED_VERSION"
    
    if [ "$INSTALLED_VERSION" = "$TARGET_VERSION" ]; then
        echo "correct version $TARGET_VERSION"
    else
        echo "current ver $INSTALLED_VERSION"
        echo "install ver $TARGET_VERSION"
        conda_run_pip_install $PACKAGE_NAME==$TARGET_VERSION
    fi
else
    echo "$PACKAGE_NAME dose not exist. start install $TARGET_VERSION"
    conda_run_pip_install "$PACKAGE_NAME==$TARGET_VERSION"
fi